<?php

use Illuminate\Database\Seeder;

class AdminUserTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $admin = [
            'admin_name' => 'admin',
            'admin_pass' => bcrypt('123456'),
            'admin_nickname' => '超级管理员',
            'admin_email' => 'admin@mall.com',
            'admin_createtime' => date('Y-m-d H:i:s'),
            'admin_status' => 1
        ];
        DB::table('admin_user')->insert($admin);

        // 填充测试数据
        $admin_nickname = ['张三','李四','王五','Lily','赏金猎人','test'];
        $admin_createtime = date('Y-m-d H:i:s');

        $seeds = [];
        foreach($admin_nickname as $k=>$v){
            $seeds[$k] = [
                'admin_name' => 'test' . $k,
                'admin_pass' => bcrypt('123456'),
                'admin_nickname' => $v,
                'admin_email' => 'test'.$k.'@mall.com',
                'admin_createtime' => $admin_createtime,
                'admin_status' => 1
            ];
        }

        DB::table('admin_user')->insert($seeds);
    }
}
